import { axios } from '@/utils/request'

const api = {
  getList: 'system/memberLevel/getSysDownList',
  getListPage: '/system/memberLevel/getList',
  typeAdd: '/system/memberLevel/add',
  typeEdit: '/system/memberLevel/edit',
  typeDel: '/system/memberLevel/del',
  typeEnable: '/system/memberLevel/enable',
  typeShow: '/system/memberLevel/show',
  deadline: '/system/dict/data/type?dictType=zz_hyxfzq',    // 完成度百分比

  /** 第二职务 */
  memberPostList: '/admin/member-post/getList',
  memberPostAdd: '/admin/member-post/add',
  memberPostEdit: '/admin/member-post/edit',
  memberPostDel: '/admin/member-post/del',
  memberPostInfo: '/admin/member-post/getInfo', //第二职务详情

  cardTemplateList: '/system/business-card-template/getList', //会员名片模板列表
  levelCardList: '/system/member-level-card/getList', //会员参会证模板列表
  memberLevelInfo: '/system/memberLevel/getInfo', //会员职务详情
  memberLevel: '/system/memberLevel/getDownList', // 申请职务列表
}

export default api

/**
  * 会员类型列表
  */
export function getList(params) {
  return axios({
    url: api.getList,
    method: 'get',
    params
  })
}

export function getListPage(params) {
  return axios({
    url: api.getListPage,
    method: 'get',
    params
  })
}

/**
* 会员类型新增
*/
export function typeAdd(data) {
  return axios({
    url: api.typeAdd,
    method: 'post',
    data
  })
}

/**
* 会员类型编辑
*/
export function typeEdit(data) {
  return axios({
    url: api.typeEdit,
    method: 'post',
    data
  })
}

/**
* 会员类型删除
*/
export function typeDel(data) {
  return axios({
    url: api.typeDel + '/' + data.ids,
    method: 'post'
  })
}

/**
* 状态禁用启用
*/
export function typeEnable(data) {
  return axios({
    url: api.typeEnable + '/' + data.id + '/' + data.status,
    method: 'post',
    data
  })
}

/**
* 职务是否开放申请
*/
export function typeShow(data) {
  return axios({
    url: api.typeShow + '/' + data.id + '/' + data.status,
    method: 'post',
    data
  })
}

/**
* 周期
*/
export function deadline() {
  return axios({
    url: api.deadline,
    method: 'get'
  })
}

/**
 * 第二职务
 */

//第二职位列表
export function memberPostList(params) {
  return axios({
    url: api.memberPostList,
    method: 'get',
    params
  })
}

//第二职位新增
export function memberPostAdd(data) {
  return axios({
    url: api.memberPostAdd,
    method: 'post',
    data
  })
}

//第二职位编辑
export function memberPostEdit(data) {
  return axios({
    url: api.memberPostEdit,
    method: 'post',
    data
  })
}

//第二职位删除
export function memberPostDel(id) {
  return axios({
    url: api.memberPostDel + `/${id}`,
    method: 'post'
  })
}

//会员名片模板列表
export function cardTemplateList() {
  return axios({
    url: api.cardTemplateList,
    method: 'get'
  })
}

//会员参会证模板列表
export function levelCardList() {
  return axios({
    url: api.levelCardList,
    method: 'get'
  })
}

//获取会员职务详情
export function memberLevelInfo(params) {
  return axios({
    url: api.memberLevelInfo,
    method: 'get',
    params
  })
}

//获取第二职务详情
export function memberPostInfo(params) {
  return axios({
    url: api.memberPostInfo + `/${params.id}`,
    method: 'get'
  })
}

/**
  * 职务
  */
export function memberLevel(params) {
  return axios({
    url: api.memberLevel,
    method: 'get',
    params
  })
}